
from flask import url_for
from application import app

class UrlManager(object):
    @staticmethod
    def buildUrl(path):
        return path

    @staticmethod
    def buildStaticUrl(path):
        ver = app.config['APP_VERSION']
        path = '/static' + path + '?ver=' + ver
        return UrlManager.buildUrl(path)

    @staticmethod
    def buildImageUrl(key):
        app_config = app.config['APP']
        # url = '域名'+'图片前缀'+'key'
        url = app_config['domain'] + app.config['UPLOAD']['prefix_url'] + key
        return url